-
Notifications
You must be signed in to change notification settings - Fork 607
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Auto-swap non-osmo tx fees to osmo #1145
Conversation
…ccount, fee routing logic, epoch hooks etc.
Codecov Report
@@ Coverage Diff @@
## main #1145 +/- ##
==========================================
- Coverage 20.26% 19.53% -0.74%
==========================================
Files 203 200 -3
Lines 26824 27532 +708
==========================================
- Hits 5436 5377 -59
- Misses 20378 21153 +775
+ Partials 1010 1002 -8
Continue to review full report at Codecov.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice work! Just left some initial minor feedback
Co-authored-by: Aleksandr Bezobchuk <[email protected]>
Co-authored-by: Aleksandr Bezobchuk <[email protected]>
Co-authored-by: Aleksandr Bezobchuk <[email protected]>
Co-authored-by: Aleksandr Bezobchuk <[email protected]>
Co-authored-by: Aleksandr Bezobchuk <[email protected]>
Co-authored-by: Aleksandr Bezobchuk <[email protected]>
Co-authored-by: Aleksandr Bezobchuk <[email protected]>
@mattverse wanna give this one more look? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Left some minor comments!
Also, would it be possible to add documnetation in spec before we merge this?
x/txfees/keeper/keeper.go
Outdated
|
||
func NewKeeper( | ||
cdc codec.Codec, | ||
accountKeeper types.AccountKeeper, | ||
bankKeeper *bankkeeper.BaseKeeper, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
reminder: Should use bank keeper from expected_keepers, instead of using it in a direct import form!
coins := sdk.NewCoins(sdk.NewInt64Coin(uion, 10), | ||
sdk.NewInt64Coin(atom, 20), | ||
sdk.NewInt64Coin(ust, 14)) | ||
|
||
swapFee := sdk.NewDec(0) | ||
|
||
expectedOutput1, err := uionPool.CalcOutAmtGivenIn(suite.Ctx, | ||
sdk.Coins{sdk.Coin{Denom: uion, Amount: coins.AmountOf(uion)}}, | ||
baseDenom, | ||
swapFee) | ||
suite.Require().NoError(err) | ||
expectedOutput2, err := atomPool.CalcOutAmtGivenIn(suite.Ctx, | ||
sdk.Coins{sdk.Coin{Denom: atom, Amount: coins.AmountOf(atom)}}, | ||
baseDenom, | ||
swapFee) | ||
suite.Require().NoError(err) | ||
expectedOutput3, err := ustPool.CalcOutAmtGivenIn(suite.Ctx, | ||
sdk.Coins{sdk.Coin{Denom: ust, Amount: coins.AmountOf(ust)}}, | ||
baseDenom, | ||
swapFee) | ||
suite.Require().NoError(err) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: would it be possible to change these to foo, bar, baz? I personally don't prefer using token names directly.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I actually think this is better than foo bar baz
suite.App.EpochsKeeper.AfterEpochEnd(futureCtx, params.DistrEpochIdentifier, int64(1)) | ||
|
||
suite.Require().Empty(suite.App.BankKeeper.GetAllBalances(suite.Ctx, moduleAddrNonNativeFee)) | ||
suite.Require().True(suite.App.BankKeeper.GetBalance(suite.Ctx, moduleAddrFee, baseDenom).Amount.GTE(fullExpectedOutput.Amount.TruncateInt())) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we change this to testing w/ precise number instead of using GTE
?
Because this is a legacy PR thats been open so long, I'm in favor of merging it, and doing spec updates in a second issue/PR, Right now theres not really a well formatted spec for this module to begin with, and I don't think its worth blocking the merge which has several useful updates, and will keep getting merge conflicts, until the spec is done |
Hiya, I was just curious what is the benefit of doing this in epoch as opposed to on the fly? Thanks |
Closes: #1121
Description
feedecorator_test.go
andhooks_test.go
)For contributor use:
docs/
) or specification (x/<module>/spec/
)Unreleased
section inCHANGELOG.md
Files changed
in the Github PR explorer